
import java.awt.*;

public class PosterMain {
    public static void main(String[] args) throws Exception {


	GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
        String[] fa=ge.getAvailableFontFamilyNames();
        for (String s:fa) {
            System.out.println(s);
        }	

        String qrCodeUrl = "https://wework.qpic.cn/wwpic/734373_Ic1wRmoORu67rYh_1646101/0"; //二维码
        String avatarUrl = "https://wework.qpic.cn/wwhead/duc2TvpEgSInfahzx80mLLicGEUia6smCyfqicBic4aHXMcyTIficp0f7Ow11v9XRqyOGs/0"; //头像
        String name = "张红";
        String position = "置业顾问";
        String project = "找不到项目信息";
        String company = "地emale";
        String tel = "13706100972";
        String bottomInfo = "扫描二维码，添加我的企业微信";

        int width = 300;//300;
        int height = 514;//514;

        Poster poster = initPoster(width,height,avatarUrl,qrCodeUrl,name,position,project,company,tel,bottomInfo);
        PosterUtil.drawPoster(poster);
    }

    private static Poster initPoster(int width,int height,String avatarUrl,String qrCodeUrl,String name,String position,String project,String company,String tel,String bottomInfo) {
        Poster poster = new Poster();
	double baseN = 1.6d;//2.4d;
        //画布
        poster.setWidth((int)(baseN * width));
        poster.setHeight((int)(baseN * height));
        //头像
        poster.setAvatarUrl(avatarUrl);
        poster.setAvatarX(0);
        poster.setAvatarY(0);
        poster.setAvatarWidth((int)(baseN * 300));//300
        poster.setAvatarHeight((int)(baseN * 300));//300

        //小程序码
        poster.setQrCodeUrl(qrCodeUrl);
        poster.setQrCodeWidth((int)(baseN * 90));//90
        poster.setQrCodeHeight((int)(baseN * 90));//90
        poster.setQrCodeX((int)(baseN * 188));//188
        poster.setQrCodeY((int)(baseN * 360));//360

        //名字
        poster.setName(name);
        poster.setNameFont(new Font("SourceHanSansSC",Font.BOLD,(int)(baseN * 18)));
        poster.setNameColor(new Color(51,51,51));
        poster.setNameX((int)(baseN*18));//18
        poster.setNameY((int)(baseN*326));//326

        //岗位
        poster.setPosition(position);
        //poster.setPositionFont(new Font("YaHei",Font.PLAIN,11));
        poster.setPositionFont(new Font("SourceHanSansSC",Font.PLAIN,(int)(baseN * 13)));
        poster.setPositionColor(new Color(119,119,119));
        poster.setPositionX((int)(baseN*18));
        poster.setPositionY((int)(baseN*346));

        //项目信息
        poster.setProject(project);
        //poster.setProjectFont(new Font("Microsoft YaHei",Font.PLAIN,13));
        poster.setProjectFont(new Font("SourceHanSansSC",Font.PLAIN,(int)(baseN * 15)));
        poster.setProjectColor(new Color(51,51,51));
        poster.setProjectX((int)(baseN*18));
        poster.setProjectY((int)(baseN*407));


        //company
        poster.setCompany(company);
        poster.setCompanyFont(new Font("SourceHanSansSC",Font.BOLD,(int)(baseN * 18)));
        poster.setCompanyColor(new Color(51,51,51));
        poster.setCompanyX((int)(baseN*18));
        poster.setCompanyY((int)(baseN*380));

        //tel
        poster.setTel(tel);
        poster.setTelFont(new Font("SourceHanSansSC",Font.PLAIN,(int)(baseN * 15)));
        poster.setTelColor(new Color(51,51,51));
        poster.setTelX((int)(baseN*18));
        poster.setTelY((int)(baseN*431));

        //底部栏 bottom
        poster.setBottomInfo(bottomInfo);
        poster.setBottomFont(new Font("SourceHanSansSC",Font.PLAIN,(int)(baseN * 13)));
        poster.setBottomColor(new Color(119,119,119));
        poster.setBottomX((int)(baseN*55));
        poster.setBottomY((int)(baseN*476));

        return poster;
    }
}
